#include <iostream>
#include "DataManager.h"

void outputTest(DataManager& outputManager)
{
    std::vector<std::string> clientNames{ "", "CA", "CB", "CC", "CD" };
    std::vector<std::string> siteNames{ "", "SA", "SB", "SC", "SD" };
    int timeNum = 3;
    int clientNum = 4;
    int siteNum = 3;

    // Time 0
    outputManager.setTime(0);

    outputManager.setClient(1);
    outputManager.writeLog(3, 100);
    outputManager.writeLog(2, 200);

    outputManager.setClient(2);
    outputManager.writeLog(3, 500);
    outputManager.writeLog(1, 400);
    outputManager.writeLog(2, 50);

    outputManager.setClient(3);
    outputManager.writeLog(2, 50);
    outputManager.writeLog(1, 400);

    // Time 1
    outputManager.setTime(1);
    outputManager.setClient(1);
    outputManager.writeLog(1, 1000);
    outputManager.writeLog(2, 2050);

    outputManager.setClient(2);
    outputManager.writeLog(2, 600);
    outputManager.writeLog(1, 300);

    outputManager.setClient(3);
    outputManager.writeLog(3, 50);
    outputManager.writeLog(1, 400);

    outputManager.setClient(4);
    outputManager.writeLog(1, 50);
    outputManager.writeLog(2, 600);

    // Time 2
    outputManager.writeLog(2, 1, 1, 1000);
    outputManager.writeLog(2, 1, 2, 2050);

    outputManager.writeLog(2, 2, 1, 1000);
    outputManager.writeLog(2, 2, 2, 2050);

    outputManager.writeLog(2, 3, 1, 1000);
    outputManager.writeLog(2, 3, 2, 2050);

    outputManager.writeLog(2, 4, 1, 1000);
    outputManager.writeLog(2, 4, 2, 2050);

    outputManager.writeFile("solution.txt");
}


void inputTest(DataManager& inputManager)
{
    /*int timeNum, clientNum;
    std::vector<std::string> clientName;
    std::vector<std::vector<int>> bandwidthDemand;
    inputManager.getDemand(timeNum, clientNum, clientName, bandwidthDemand);
    std::cout << "timeNum: " << timeNum << "\n";
    std::cout << "clientNum: " << clientNum << "\n";
    for (int i = 1;i <= clientNum;++ i)
    {
        std::cout << clientName[i] << " ";
    }
    std::cout << "\n";
    for (int i = 1; i <= timeNum; ++i)
    {
        std::cout << "Time " << i << ":";
        for (int j = 1; j <= clientNum; ++j)
        {
            std::cout << bandwidthDemand[i][j];
            if (j != clientNum) std::cout << ",";
        }
        std::cout << "\n";
    }*/

    /*int siteNum;
    std::vector<std::string> siteName;
    std::vector<int> bandwidthLimit;
    inputManager.getSite(siteNum, siteName, bandwidthLimit);
    std::cout << "siteNum: " << siteNum << "\n";
    for (int i = 1; i <= siteNum; ++i)
    {
        std::cout << "Site " << i << ": " << siteName[i] << ", " << bandwidthLimit[i] << "\n";
    }*/

    /*int qosLimit;
    std::vector<std::pair<int, int>> graph;
    inputManager.getQosGraph(qosLimit, graph);
    std::cout << "qosLimit:" << qosLimit << "\n";
    for (auto& node : graph)
    {
        std::cout << "(" << node.first << ", " << node.second << ")\n";
    }*/

    std::cout << "TotleTime: " << inputManager.getTotalTime() << "\n";

    int siteNum, clientNum;
    std::vector<std::pair<int, int>> graph;
    inputManager.getQosGraph(siteNum, clientNum, graph);
    std::cout << "clientNum: " << clientNum << "\n";
    std::cout << "siteNum: " << siteNum << "\n";
    for (auto& node : graph)
    {
        std::cout << "(" << node.first << ", " << node.second << ")\n";
    }

    std::vector<int> bandwidthDemand;
    inputManager.getDemands(6, bandwidthDemand);
    std::cout << "timeID: " << 6 << "\n";
    for (int i = 1; i <= clientNum; ++i)
    {
        std::cout << bandwidthDemand[i];
        if (i != clientNum) std::cout << ",";
        else std::cout << "\n";
    }

    std::vector<int> bandwidthLimit;
    inputManager.getSiteLimits(bandwidthLimit);
    std::cout << "bandwidth limit:\n";
    for (int i = 1; i <= siteNum; ++i)
    {
        std::cout << "siteID: " << i << ", " << bandwidthLimit[i] << "\n";
    }


    return;
}
/*
int main()
{
    DataManager dataManager("..//..//..//data//");
    inputTest(dataManager);
    //outputTest(dataManager);
    return 0;
}*/